<%@page import="javax.print.DocFlavor.STRING"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="../common/prama.jsp" %>
<%
	List<HashMap<String, Object>> todoTypes = (List<HashMap<String, Object>>)request.getAttribute("todoTypes");
	List<HashMap<String, Object>> infoTypes = (List<HashMap<String, Object>>)request.getAttribute("infoTypes");
	HashMap<String, String> model = null;
	List<HashMap<String,String>> useList = null;
	List<HashMap<String,String>> buildingList = null;
	String modelInfoType = "";
	String modelTodoType = "";
	if(request.getAttribute("model") != null ){
		model = (HashMap<String, String>)request.getAttribute("model");
		modelInfoType = model.get("INFO_TYPE");
		modelTodoType = model.get("TODO_TYPE");
	}
	if(request.getAttribute("useList") != null ){
		useList = (List<HashMap<String,String>>)request.getAttribute("useList");
	}
	if(request.getAttribute("buildingList") != null ){
		buildingList = (List<HashMap<String,String>>)request.getAttribute("buildingList");
	}
%>
<script type="text/javascript" src="${burl }/js/business/manager/sent_todo.js"></script>
<div class="CommonPanel">
	<button id="todoRetuenBtn">返回</button>
</div>
<div id="searchDiv" class="CommonPanel">
<table>
	<tr>
		<td class="label lagre" >标题：</td>
		<td class="input" style="width:175px"><input type="text" id="title" value="${model.TITLE }" /></td>
		<td class="label lagre" style="width:155px">采集类型：</td>
		<td class="input">
			<select id="type" style="width:171px">
				<%
					for(int i=0;i<infoTypes.size();i++){
						String id = infoTypes.get(i).get("ID")+"";
						String name = infoTypes.get(i).get("NAME")+"";
						String selected = id.equals(modelInfoType)? "selected":"";
					%>
					<option <%=selected %> value="<%=id%>"><%=name %></option>
					<%
					}
				%>
			</select>
		</td>
	</tr>
	<tr>
		<td class="label lagre">结束时间：</td>
		<td   class="input">
			<input id="end_date" value='${model.END_TIME }'/> 
		</td>
		<td class="label lagre">备注：</td>
		<td >
			<input type="text" id="note" value='${model.REMARKS }' />
		</td>
	</tr>
	<tr>
		<td class="label lagre">目标人员：</td>
		<td class="input" colspan="3">
			<div id="people" >
				<%
				if(useList != null){
					for(int i=0;i<useList.size();i++){
						String id = useList.get(i).get("ID");
						String name = useList.get(i).get("SHOWNAME");
						String cc = "";
						if(i<useList.size()-1){
							cc = "、";
						}
					%>
						<span tag='<%=id%>'><%=name %></span> <%=cc %>
					<%
					}
				}
				%>
			</div>
			<a id="checkperson" >选择人员</a>
		</td>
	</tr>
	<tr>
		<td class="label lagre">待办类型：</td>
		<td class="input" id="todo_type_td" colspan="3">
				<%
					for(int i=0;i<todoTypes.size();i++){
						String id = todoTypes.get(i).get("ID")+"";
						String name = todoTypes.get(i).get("NAME")+"";
						String selected = id.equals(modelTodoType)? "checked":"";
					%>
					<label><input <%=selected %> type="radio" value="<%=id %>" name="mbld"/><%=name %></label>
					<%
					}
				%>
		</td>
	</tr>
	<tr id="todoType1" style="display:none">
		<td  class="label lagre">
			楼栋数：
		</td>
		<td id="input">
			<input type="text" id="todonum" value="${model.TODO_NUM }" />
		</td>
	</tr>
	<tr id="todoType2">
		<td class="label lagre">目标楼栋：</td>
		<td class="input" colspan="3">
			<a id="checkczw" >选择楼栋</a>
			<div class="czw_grid_div" style="width:930px">
				<table id="czw_grids" style="width:900px;margin-top: 8px" class="czwGrid_data">
				<tr>
					<th>地址</th>
					<th>类型</th>
					<th>楼栋编号</th>
					<th>操作</th>
				</tr>
				<%
				if(buildingList != null){
					for(int i = 0;i<buildingList.size();i++){
						String build_type_name = buildingList.get(i).get("BUILD_TYPE_NAME");
						String buildCode = buildingList.get(i).get("BUILDING_CODE");
						String addr = buildingList.get(i).get("ADDR");
				%>
					<tr>
						<td><%=addr %></td>
						<td><%=build_type_name %></td>
						<td><%=buildCode %></td>
						<td name='todo'><a>删除</a></td></tr>
					</tr>
				<%
					}
				}
				%>
				</table>
			</div>
		</td>
	</tr>
	<tr id="todoType3" style="display:none">
		<td class="label lagre">督办内容：</td>
		<td class="input" colspan="3">
			<textarea id="dubanContent" name="dubanContent" style="height: 220px;width: 970px;" >
				${model.DUBAN_CONTENT}
			</textarea>
		</td>
	</tr>
</table>
</div>
<%
	if(model == null){
		%>
		<button style="border: 1px solid rgb(177, 196, 245);
				background-color: rgb(77, 88, 221);
				width: 200px;
				height: 50px;
				color: rgb(211, 197, 234);
				float: right;
				font-size: 24px;" id="sent_btn" >发送</button>
<%
	}
%>
